package service;

/**
 * @author: jie.zhao
 * @create: 2021/03/20 18:54
 */
public class HttpProtocolUtil {

    public static String getHeader200(int contentLength){
        return "HTTP/1.1 200 OK \n" +
                "Content-Type: text/plain; charset=UTF-8 \n"+
                "Content-Length: " + contentLength +"\n" +
                "\r\n";
    }

    public static String getHeader400(){
        String str404 = "<h1>404 not found</h1>";
        return "HTTP/1.1 404 NOT FOUND \n" +
                "Content-Type: text/plain; charset=UTF-8 \n"+
                "Content-Length: " + str404.getBytes().length +"\n" +
                "\r\n" + str404;
    }


}
